<!-- #INCLUDE Virtual="/lib.asp" -->
<!-- #INCLUDE Virtual="/lib_gen.asp" -->

<%
dim rss, objXMLDom, objXMLdata
dim rssTitle, rssInhoud
const rssError = "Geen JIRA data ontvangen"
rssInhoud = rssError

Dim http: Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")

Set objXMLDom = Server.CreateObject("Microsoft.XMLDOM")
objXMLDom.preserveWhiteSpace = true
objXMLDom.async = false
objXMLDom.resolveExternals = false

objXMLDom.setProperty "SelectionNamespaces", "xmlns=""http://www.w3.org/2005/Atom"" xmlns:atlassian=""http://streams.atlassian.com/syndication/general/1.0"" xmlns:thr=""http://purl.org/syndication/thread/1.0"" xmlns:activity=""http://activitystrea.ms/spec/1.0/"""

on error resume next

'Always specify username/password here, for fail safety
http.open "GET", "https://issues.onehippo.com/activity?maxResults=3&streams=key+IS+POLITIENL&os_authType=basic&title=undefined", False,"",""
http.setRequestHeader "Authorization", "Basic " & application("Jira_Key") 'Base64Encode("username:password")
http.send

rss = http.responseText

objXMLDom.loadXML(rss)
Set objXMLdata = objXMLDom.documentElement

dim node
for each item in objXMLdata.selectNodes("//entry")
	'<link rel="photo" href="https://issues.onehippo.com/secure/useravatar?avatarId=10382&amp;s=48" media:height="48" media:width="48" xmlns:media="http://purl.org/syndication/atommedia"/>
	'https://issues.onehippo.com/secure/useravatar?ownerId=rdewijngaert&amp;avatarId=13362&amp;s=48
	set node = item.selectSingleNode("./author/link[@rel='photo' and @media:height='48']")
	if not node is nothing then 
		'if instr(item.selectSingleNode("title").text, "ViewProfile.jspa?name=jvgrouw") > 0 then
		'	photo = "http://www.4us2be.com/wp-content/uploads/2010/01/clown.png"
		'else
			photo = "jira_image.asp?url=" & server.urlEncode(node.getAttribute("href"))
		'end if
	else
		photo = ""
	end if
	if rssInhoud = rssError then rssInhoud = ""
	rssInhoud = rssInhoud & "<div class=""activity-item clearfix""><img src=""" & photo & """>" & item.selectSingleNode("title").text
	rssInhoud = rssInhoud & "</div>"
next

call generatePage(request("preview"), request.querystring("nextpage"), "Jira activity", rssImage, rssInhoud)

%>